home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
util
/
pack
/
xpk_Source.lha
/
xpk_Source
/
xpkmaster
/
checksum.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-11-09
|
812b
|
43 lines
#ifndef XPKMASTER_CHECKSUM_C
#define XPKMASTER_CHECKSUM_C
/* Routinesheader
Name: checksum.c
Main: xpkmaster
Versionstring: $VER: checksum.c 1.3 (09.01.1998)
Author: SDI
Distribution: Freeware
Description: Simple checksum routines
1.0 05.10.96 : first real version
1.1 30.01.97 : added new option to cchecksum, became necessary
1.2 31.01.97 : removed new option
1.3 09.01.98 : added XPK_ALLINONE
*/
#include <exec/types.h>
#include "xpkmaster.h"
XPK_ALLINONE UBYTE hchecksum(STRPTR ptr, ULONG count)
{
register UBYTE sum = 0;
while(count-- > 0)
sum ^= *ptr++;
return sum;
}
XPK_ALLINONE UWORD cchecksum(ULONG *ptr, ULONG count)
{
register ULONG sum = 0;
while(count-- > 0)
sum ^= *ptr++;
return (UWORD) (sum ^ (sum >> 16));
}
#endif /* XPKMASTER_CHECKSUM_C */